package com.itheima.Demo;

import java.util.Scanner;

public class Case {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入身高m单位：");
        double height = sc.nextDouble();

        System.out.println("请输入体重：");
        int weight = sc.nextInt();

        System.out.println("请输入性别：");
        char sex = sc.next().charAt(0);

        System.out.println("请输入年龄：");
        int age = sc.nextInt();

        BmiFun(weight, height);
        BMR(weight, height, age, sex);

    }

    public static void BmiFun(int weight, double height) {
        // BMI 身体指数 BMI = 体重(kg) / (身高 * 身高)
        double result = 0;
        result = weight / (height * height);
        System.out.println("BMI指数为：" + result);
        if (result < 18.5) {
            System.out.println("体重过轻");
        } else if (result < 24.9) {
            System.out.println("体重正常");
        } else if (result < 29.9) {
            System.out.println("体重过重");
        } else {
            System.out.println("体重肥胖");
        }
    }

    public static void BMR(int weight, double height, int age, char sex) {
        // BMR
        // 男性 基础代谢率 BMR = 10 * 体重(kg) + 6.25 * 身高(cm) - 5 * 年龄(岁) + 5
        // 女性 BMR = 10 * 体重(kg) + 6.25 * 身高(cm) - 5 * 年龄(岁) - 161
        int constant = sex == '男' ? 5 : -161;
        double result = 10 * weight + 6.25 * height - 5 * age + constant;
        System.out.println("BMR为：" + result + "你的性别是" + sex);
        System.out.println("你的性别是" + sex +
                "\n" + "你的身高是" + height +
                "\n" + "你的体重是" + weight +
                "\n" + "你的年龄是" + age);
    }
}
